/**
 *  math.inl
 *  AwkwardEngine - Math
 *
 *  Date: 19/08/2013
 *
 *  Language: C++
 *
 *  @author Carl McCaffrey
 *
 */
#ifndef MATH_INL
#define MATH_INL

#include <math.h>

inline float cMathSqrt(float f)
{
	return sqrt(f);
}

inline float cMathInvSqrt(float f)
{
	const int ROUGHSQRT = 0x5f3759df;
	long l;
	float f1, f2;

	f1 = f * 0.5f;
	f2 = f;
	l = *reinterpret_cast<long*>(&f2);
	l = ROUGHSQRT - (l >> 1);
	f2 = *reinterpret_cast<float*>(&l);
	f2 = f2 * (1.5f - (f1 * f2 * f2));

	return f2;
}

inline float cMathSin(float f)
{
	return sin(f);
}

inline float cMathCos(float f)
{
	return cos(f);
}

inline float cMathTan(float f)
{
	return tan(f);
}

inline float cMathATan2(float y, float x)
{
	return atan2(y, x);
}

inline float cMathPow(float x, float y)
{
	return pow(x, y);
}

inline float cMathLog(float f)
{
	return log(f);
}

inline float cMathAbs(float f)
{
	return fabs(f);
}

inline float cMathFloor(float f)
{
	return floorf(f);
}

inline float cMathCeil(float f)
{
	return ceilf(f);
}

inline float cMathRint(float f)
{
	return floorf(f + 0.5f);
}

inline float cMathDegToRad(float f)
{
	return f * (cMathPI / 180.0f);
}

inline float cMathRadToDeg(float f)
{
	return f * (180.0f / cMathPI);
}

inline float cMathSecToMs(float f)
{
	return f * 1000;
}

inline float cMathMsToSec(float f)
{
	return f * 0.001f;
}

#endif // MATH_INL